package com.ftg.wymall.admin.controller;

import com.ftg.wymall.admin.dto.UserInfo;
import com.ftg.wymall.admin.entity.UmsMenu;
import com.ftg.wymall.admin.service.IUmsAdminService;
import com.ftg.wymall.admin.service.IUmsMenuService;
import com.ftg.wymall.admin.vo.UmsAdminVo;
import com.ftg.wymall.admin.vo.UmsMenuTreeVo;
import com.ftg.wymall.comm.vo.ConstUtil;
import com.ftg.wymall.comm.vo.RespMessUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 后台用户表 前端控制器
 * </p>
 *
 * @author kangjx
 * @since 2023-10-20
 */
@RestController
@Api(tags = "菜单")
@RequestMapping("/ums/menu/umsMenu")
public class UmsMenuController {

    @Resource
    IUmsMenuService iUmsMenuService;

    @GetMapping("/showMenuByAdminId")
    @ApiOperation("依据adminid查找menu")
    public RespMessUtil<List<UmsMenuTreeVo>> showMenuByAdminId(
            @ApiParam(name = ConstUtil.TOKEN_NAME,value = ConstUtil.TOKEN_NAME_ZH,required = true) @RequestHeader(value = ConstUtil.TOKEN_NAME) String token
    ){
        return iUmsMenuService.showMenuByAdminId(token);
    }

    @GetMapping("/allMenu")
    @ApiOperation("查询全部角色信息用来生成树")
    public RespMessUtil<List<UmsMenuTreeVo>> allMenuForTree(){
        return iUmsMenuService.allMenuForTree();
    }
}
